package com.maket.scxx.service.impl;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;

import com.maket.scxx.feign.GetCodeFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.maket.scxx.mapper.WldaMaterialFileMapper;
import com.maket.scxx.domain.WldaMaterialFile;
import com.maket.scxx.service.IWldaMaterialFileService;

/**
 * 物料档案Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-06-25
 */
@Service
public class WldaMaterialFileServiceImpl implements IWldaMaterialFileService 
{
    @Autowired
    private WldaMaterialFileMapper wldaMaterialFileMapper;

    /**
     * 查询物料档案
     * 
     * @param wlCode 物料档案主键
     * @return 物料档案
     */
    @Override
    public WldaMaterialFile selectWldaMaterialFileByWlCode(String wlCode)
    {
        return wldaMaterialFileMapper.selectWldaMaterialFileByWlCode(wlCode);
    }

    /**
     * 查询物料档案列表
     * 
     * @param wldaMaterialFile 物料档案
     * @return 物料档案
     */
    @Override
    public List<WldaMaterialFile> selectWldaMaterialFileList(WldaMaterialFile wldaMaterialFile)
    {
        return wldaMaterialFileMapper.selectWldaMaterialFileList(wldaMaterialFile);
    }

    /**
     * 新增物料档案
     * 
     * @param wldaMaterialFile 物料档案
     * @return 结果
     */
    @Autowired
    private GetCodeFeign getCodeFeign;
    @Override
    public int insertWldaMaterialFile(WldaMaterialFile wldaMaterialFile)
    {
        String code = getCodeFeign.getUser(14);
        wldaMaterialFile.setWlCode(code);
        wldaMaterialFile.setWlCreatetime(new Date());
        return wldaMaterialFileMapper.insertWldaMaterialFile(wldaMaterialFile);
    }

    /**
     * 修改物料档案
     * 
     * @param wldaMaterialFile 物料档案
     * @return 结果
     */
    @Override
    public int updateWldaMaterialFile(WldaMaterialFile wldaMaterialFile)
    {
        return wldaMaterialFileMapper.updateWldaMaterialFile(wldaMaterialFile);
    }

    /**
     * 批量删除物料档案
     * 
     * @param wlCodes 需要删除的物料档案主键
     * @return 结果
     */
    @Override
    public int deleteWldaMaterialFileByWlCodes(String[] wlCodes)
    {
        return wldaMaterialFileMapper.deleteWldaMaterialFileByWlCodes(wlCodes);
    }

    /**
     * 删除物料档案信息
     * 
     * @param wlCode 物料档案主键
     * @return 结果
     */
    @Override
    public int deleteWldaMaterialFileByWlCode(String wlCode)
    {
        return wldaMaterialFileMapper.deleteWldaMaterialFileByWlCode(wlCode);
    }
}
